package part12_命令模式_一个app控制所有家电;

/**
 * @ClassName: LightOnCommand
 * @Author: AllenSun
 * @Date: 2020/3/4 23:41
 */
public class TvOffCommand implements Command {

    //命令接收器
    TvReceiver tv;

    //构造器
    public TvOffCommand(TvReceiver tv) {
        this.tv = tv;
    }

    //聚合电灯reciver
    @Override
    public void execute() {
        //调用接受者的方法
        tv.off();
    }

    @Override
    public void undo() {
        tv.on();
    }
}
